<?php
/**
* Ecommerce Web Content Management System
* @copyright (c) 2011 ewcms team http://www.ewcms.org
* @license  GNU GENERAL PUBLIC LICENSE (GPLv3)
* @author iceweb
*/
class wsInput
{
	private static $rule="/^([a-z0-9\-\.\@,\|]+)$/i";
	
	public function get($varName)
	{
		$var=isset($_GET[$varName]) ?$_GET[$varName] :'';
		if(preg_match(self::$rule,$varName))
		{
			return $var;
		}
		return '';
	}
	
	public function post($varName)
	{
		$var=isset($_POST[$varName]) ?$_POST[$varName] :'';
		return htmlspecialchars(trim($var),ENT_QUOTES);
	}
	
	public function cookie($varName)
	{
		$var=isset($_COOKIE[$varName]) ?$_COOKIE[$varName] :'';
		if(preg_match(self::$rule,$varName))
		{
			return $var;
		}
		return '';
	}
}
